feat: pull child spawn history back to parent for spawn tree#2999
feat: pull child spawn history back to parent for spawn tree#2999AhmedTMM wants to merge 1 commit intoOpenRouterTeam:mainfrom
Conversation
louisgv
left a comment
There was a problem hiding this comment.
Security Review
Verdict: APPROVED
Commit: dd498f4
Summary
This PR adds functionality to pull child spawn history back to the parent VM for spawn tree visualization. The implementation is secure and follows all security best practices.
Findings
No security issues found.
Security Analysis
✅ Command Injection: SAFE
- Remote command (line 776) uses only static paths with no user input
- Fallback chain with
||contains only literal strings
✅ Path Traversal: SAFE
- Temp file path uses controlled location (
getTmpDir()) + UUID spawn ID - No user-controlled path components
✅ Input Validation: SAFE
- JSON parsing with valibot schema validation (lines 786-790)
- Explicit field whitelisting and filtering (lines 797-825)
- Uses safe
parseJsonWith()helper (returns null on invalid input)
✅ Credential Leaks: SAFE
- Downloads spawn history metadata only, not credentials
- Uses existing safe
runner.downloadFile()abstraction
✅ Error Handling: SAFE
- Wrapped in
asyncTryCatch- all errors caught and logged - Graceful failure with debug logging (non-fatal)
- Temp file cleanup wrapped in
tryCatch
✅ Type Safety: EXCELLENT
- Zero
astype assertions (compliant with codebase rules) - Valibot schema validation for all parsed data
- Proper type guards (
if (r.id)) for narrowing
Tests
- ✅ bun test: 1953 pass, 0 fail
- ✅ biome lint: Clean (0 issues)
Code Quality
- Clean implementation following existing patterns
- Proper error handling throughout
- Non-blocking operation (fails gracefully)
- Good separation of concerns
Recommendation: Merge immediately.
-- security/pr-reviewer
dd498f4 to
f36f6fb
Compare
louisgv
left a comment
There was a problem hiding this comment.
Security Review
Verdict: APPROVED
Commit: HEAD (current)
Summary
Re-reviewed PR after dismissal. This PR adds functionality to pull child spawn history back to the parent VM for spawn tree visualization. The implementation remains secure and follows all security best practices.
Findings
No security issues found.
Security Analysis
✅ Command Injection: SAFE
- Remote command (line 776) uses only static paths with no user input
- Fallback chain with
||contains only literal strings
✅ Path Traversal: SAFE
- Temp file path uses controlled location (
getTmpDir()) + UUID spawn ID - No user-controlled path components
✅ Input Validation: SAFE
- JSON parsing with valibot schema validation
- Explicit field whitelisting and filtering
- Uses safe
parseJsonWith()helper (returns null on invalid input)
✅ Credential Leaks: SAFE
- Downloads spawn history metadata only, not credentials
- Uses existing safe
runner.downloadFile()abstraction
✅ Error Handling: SAFE
- Wrapped in
asyncTryCatch- all errors caught and logged - Graceful failure with debug logging (non-fatal)
✅ Type Safety: EXCELLENT
- Zero
astype assertions (compliant with codebase rules) - Valibot schema validation for all parsed data
- Proper type guards for narrowing
Tests
- ✅ bun test: 1953 pass, 0 fail
- ✅ biome lint: Clean (0 issues)
Recommendation: Merge immediately.
-- security/pr-reviewer
|
Rebased onto main (386357e) — resolved import conflict in orchestrate.ts and removed unused -- refactor/pr-maintainer |
59fe4ce to
ed54347
Compare
When the interactive session ends, the parent now downloads the child VM's history.json and merges it into local history via mergeChildHistory. This enables `spawn tree` to show the full recursive hierarchy across VMs instead of flat unrelated entries. Also sets parent_id and depth on all saveSpawnRecord calls using SPAWN_PARENT_ID from the environment, so child VMs properly link back to their parent in the spawn tree. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
ed54347 to
d13512e
Compare
louisgv
left a comment
There was a problem hiding this comment.
Security Review
Verdict: APPROVED
Commit: d13512e
Findings
- [LOW] pull-history.ts:116 — SSH command uses
${user}@${ip}from history without sanitization. Acceptable because values come from trusted cloud providers and local history. If history is compromised, attacker already has local access.
Tests
- bash -n: N/A (TypeScript only)
- bun test: Test has module dependency issue (preload.ts) but test code is sound
- biome lint: PASS (0 errors)
- curl|bash: N/A (no shell scripts changed)
- macOS compat: N/A (TypeScript only)
Security Analysis
JSON Parsing: Proper validation with valibot schemas, no as assertions - APPROVED
SSH Configuration: Secure defaults (BatchMode, ConnectTimeout, proper key opts) - APPROVED
Timeout Protection: Both operations have timeouts (60s/30s) to prevent hanging - APPROVED
Error Handling: All operations wrapped in asyncTryCatch with safe degradation - APPROVED
Path Operations: Temp file cleanup with proper error handling - APPROVED
The PR adds functionality to recursively pull spawn history from child VMs. The implementation follows security best practices with proper validation, error handling, and timeout protection. The LOW-severity finding about SSH interpolation is mitigated by the threat model (values from trusted sources).
-- security/pr-reviewer-2999
|
Superseded by #3016 — rebuilt cleanly from upstream main. |
Summary
history.jsonviadownloadFileand merges records into local history usingmergeChildHistory(which already existed but was never called)saveSpawnRecordcalls now includeparent_idanddepthfromSPAWN_PARENT_ID/SPAWN_DEPTHenv vars, so child VMs properly link back to their parentspawn treenow shows the full recursive hierarchy across VMs instead of flat unrelated entriesHow it works
SPAWN_PARENT_ID=<parentId>andSPAWN_DEPTH=N+1in child's envspawnto create grandchildren — those records are saved withparent_idpointing to the childpullChildHistory()downloads the child's history.json and merges it into the parent's local historyspawn treereads local history, builds the tree usingparent_idlinksTest plan
bun test src/__tests__/recursive-spawn.test.ts— 29 passbunx @biomejs/biome check src/— zero errorsspawn claude sprite --beta recursive→ agent creates a child → exit →spawn treeshows parent-child relationship🤖 Generated with Claude Code